package com.springinaction.ch02;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/*注解 装配 java类 + 自动*/
@Component
public class CDPlayer  implements MediaPlayer {
    private CompactDisc cd;

    @Autowired
    public CDPlayer(CompactDisc cd) {
        this.cd = cd;
    }

    public void setCd(CompactDisc cd) {
        this.cd = cd;
    }

    @Override
    public void play() {
        cd.play();
    }


}



